/*
day53_5
2019.10.20
*/

struct TreeNode{
	int val;
	struct TreeNode *left;
	struct TreeNode *right;
};

int cur=0;
bool hasPathSum(struct TreeNode* root, int sum)
{
	if(!root) return false;
	cur+=root->val;
	
	if(!root->left&&!root->right&&cur==sum) return true;
	
	if(root->left)
	{
		if(hasPathSum(root->left, sum)) return true;
		cur-=root->left->val;
	}
	
	if(root->right)
	{
		if(hasPathSum(root->right, sum)) return true;
		cur-=root->right->val;
	}
	cur-=root->val;
	
	return false;
}


int main()
{
	return 0;
}
